import React from 'react';
import { render } from 'react-dom';
import ReactDom from 'react-dom';
import {Route, Link, BrowserRouter as Router} from 'react-router-dom';
import Login from "./component/login";
import Reg from "./component/reg";



const Home = () => (
  <div><h2>Home2...</h2></div>
);

const About = () => (
  <div><h2>About2++++</h2></div>
);

const App = () => (
  <Router>
    <div>
      <Route exact path="/" component={Home} />
      <Route path="/about" component={About} />
      <Route path="/login" component={Login} />
      <Route path="/reg" component={Reg} />

    </div>
  </Router>
);

class Root extends React.Component {
  render() { return (

    
    <Router>

      <div>
        <div>
          <ul>
            <li><Link to="/">主页</ Link></li>
            <li><Link to="/about">关于</ Link></li>
            <li><Link to="/login">登陆</ Link></li>
            <li><Link to="/reg">注册</ Link></li>
          </ul>
        </div>
        <Route exact path="/" component={Home} />
        <Route path="/about" component={About} />
        <Route path="/login" component={Login} />
        <Route path="/reg" component={Reg} />  
      </div>
    </Router>
  )};
}

// ReactDom.render(<App />, document.getElementById("root"));

ReactDom.render(<Root />, document.getElementById("root"));
